@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --accent: #4caf50;
  --text: #222;
  --border: #ddd;
  --shadow: 0 4px 10px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
  --bg: #121212;
  --card: #1e1e1e;
  --text: #eee;
  --border: #333;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 2rem;
  transition: background 0.3s ease, color 0.3s ease;
}

.app {
  max-width: 900px;
  margin: auto;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem;
  backdrop-filter: blur(8px);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.8rem;
}

.actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Buttons */
button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}
button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* Theme Toggle */
.theme-toggle-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle {
  position: relative;
  width: 44px;
  height: 22px;
}
.theme-toggle input {
  display: none;
}
.slider {
  position: absolute;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  border-radius: 20px;
  transition: 0.4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 2px; bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Habit List */
#habitList {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.habit-item {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.habit-item:hover {
  transform: scale(1.01);
}
.habit-info {
  flex: 1;
}
.habit-progress {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.habit-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.delete-btn {
  background: #e74c3c;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
}
.delete-btn:hover {
  background: #c0392b;
}

/* Calendar */
.month-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}
#calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 1rem;
}
.day {
  aspect-ratio: 1/1;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}
.day.checked {
  background: var(--accent);
  color: white;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: var(--card);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 300px;
}
.modal.show {
  display: flex;
}